<template>
  <view class="demand-list-my">
    <view v-if="type === 1">
      <view class="item" v-for="item in list" :key="item.id" @click="goDetail(item)">
        <demand :info="item"></demand>
      </view>
    </view>
    <view v-if="type === 2">
      <view class="item" v-for="item in list" :key="item.userId" @click="goDetail(item)">
        <demand :info="item"></demand>
      </view>
    </view>
    <view v-if="type === 3">
      <view class="item" v-for="item in list" :key="item.id" @click="goDetail(item)">
        <stand-item :info="item"></stand-item>
      </view>
    </view>
    <view class="more">
      <u-loadmore :status="status" />
    </view>
  </view>
</template>

<script>
import demand from './demand.vue'
import standItem from './standItem.vue'
export default {
  components: {
    demand,
    standItem,
  },
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    type: {
      type: Number,
      default: 1,
    },
    status: {
      type: String,
      default: 'end',
    },
  },
  data() {
    return {}
  },
  methods: {
    goDetail(item) {
      if (!this.identifying)
        return uni.showToast({
          title: '暂无权限，请先进行身份认证',
          icon: 'none',
        })
      if (this.type === 2) {
        // 专家详情
        this.$routeUtils.navigateTo({
          url: `/pages/form/workerForm?userId=${item.userId}`,
        })
      } else if (this.type === 1) {
        // 企业信息详情
        this.$routeUtils.navigateTo({
          url: `/pages/index/businessDetail?id=${item.id}`,
        })
      } else {
        // 建站详情
        this.$routeUtils.navigateTo({
          url: `/pages/index/standDetail?id=${item.id}`,
        })
      }
    },
  },
}
</script>

<style scoped lang="scss">
.demand-list-my {
  padding: 0rpx;
  .item {
    margin-bottom: 30rpx;
  }
  .item:last-child {
    margin-bottom: 0rpx;
  }
}
.more {
  margin-top: 20rpx;
}
</style>
